<template>
  <div>
    <oolongTag>标签一</oolongTag>
    <oolongTag>标签二</oolongTag>
    <oolongTag v-if="show" closable @on-close="handleClose">标签三</oolongTag>
    <br><br>
    <oolongTag type="border">标签三</oolongTag>
    <oolongTag type="border" closable>标签四</oolongTag>
    <oolongTag type="dot">标签一</oolongTag>
    <oolongTag type="dot" closable>标签二</oolongTag>
    <br><br>
    <oolongTag closable color="blue">标签一</oolongTag>
    <oolongTag closable color="green">标签二</oolongTag>
    <oolongTag closable color="red">标签三</oolongTag>
    <oolongTag closable color="yellow">标签四</oolongTag>
    <br><br>
    <oolongTag type="border" closable color="blue">标签一</oolongTag>
    <oolongTag type="border" closable color="green">标签二</oolongTag>
    <oolongTag type="border" closable color="red">标签三</oolongTag>
    <oolongTag type="border" closable color="yellow">标签四</oolongTag>
    <br><br>
    <oolongTag type="dot" closable color="blue">标签一</oolongTag>
    <oolongTag type="dot" closable color="green">标签二</oolongTag>
    <oolongTag type="dot" closable color="red">标签三</oolongTag>
    <oolongTag type="dot" closable color="yellow">标签四</oolongTag>
    <br><br>
    <oolongTag v-for="item in count" :key="item" :name="item" closable @on-close="handleClose2">标签{{ item + 1 }}
    </oolongTag>
    <oolongButton icon="ios-plus-empty" type="dashed" size="small" @click="handleAdd">添加标签</oolongButton>
  </div>
</template>
<script>

  export default{
    data () {
      return {
        show: true,
        count: [0, 1, 2]
      }
    },
    methods: {
      handleClose () {
        this.show = false;
      },
      handleAdd () {
        if (this.count.length) {
          this.count.push(this.count[this.count.length - 1] + 1);
        } else {
          this.count.push(0);
        }
      },
      handleClose2 (event, name) {
        const index = this.count.indexOf(name);
        this.count.splice(index, 1);
      }
    }
  }
</script>
<style lang="scss" scoped>

</style>
